#!/usr/bin/env bash
#
# Starts a new docker container
#
set -ef -o pipefail
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
LOCAL_PATH=$(pwd)

if command -v wslPath &> /dev/null; then
  LOCAL_PATH="$(wslpath -w $(pwd))"
fi

source "${DIR}/functions.sh"
dockerfile=$1
shift
docker run \
  --volume "${LOCAL_PATH}":/app \
  --volume "${HOME}/.m2":/home/cukebot/.m2 \
  --volume "${HOME}/.gitconfig":/home/cukebot/.gitconfig \
  --user 1000 \
  --rm \
  -it $(docker_image ${dockerfile}) $@
